import request from "@/utils/request";

// 查询优惠劵列表
export function listInfo(query) {
  return request({
    url: "/coupon/info/list",
    method: "get",
    params: query,
  });
}

// 查询优惠劵详细
export function getInfo(id) {
  return request({
    url: "/coupon/info/" + id,
    method: "get",
  });
}

// 新增优惠劵
export function addInfo(data) {
  return request({
    url: "/coupon/info",
    method: "post",
    data: data,
  });
}

// 修改优惠劵
export function updateInfo(data) {
  return request({
    url: "/coupon/info",
    method: "put",
    data: data,
  });
}

// 删除优惠劵
export function delInfo(id) {
  return request({
    url: "/coupon/info/" + id,
    method: "delete",
  });
}

// 导出优惠劵
export function exportInfo(query) {
  return request({
    url: "/coupon/info/export",
    method: "get",
    params: query,
  });
}

// 导出优惠劵
export function verificationList(query) {
  return request({
    url: "/station/message/getStationDifferent",
    method: "get",
    params: query,
  });
}

//查询优惠劵状态

export function selectCouponEnableFalge(data) {
  return request({
    url: "/coupon/info/selectCouponEnableFalge",
    method: "get",
    data: data,
  });
}
// 开启关闭优惠劵
export function changeCouponStatus(data) {
  return request({
    url: "/enterprise/info/updateCouponEnabledFlag",
    method: "post",
    data: data,
  });
}

// 新增优惠劵发放方式
export function addIssue(data) {
  return request({
    url: "/coupon/issue",
    method: "post",
    data: data,
  });
}

// 修改优惠劵发放方式
export function updateIssue(data) {
  return request({
    url: "/coupon/issue",
    method: "put",
    data: data,
  });
}
// 查询发放方式
export function listIssue(query) {
  return request({
    url: "/coupon/issue/list",
    method: "get",
    params: query,
  });
}

// 新增优惠劵发放方式
export function upIssueStatus(data) {
  return request({
    url: "/coupon/issue/updateCouponIssueStatus",
    method: "put",
    data: data,
  });
}

// 用户优惠卷信息
export function queryCouponUserList(query) {
  return request({
    url: "/coupon/user/list",
    method: "get",
    params: query,
  });
}

// 用户优惠卷信息
export function queryCouponInfo(id) {
  return request({
    url: "/coupon/issue/" + id,
    method: "get",
  });
}

// 查询发布过的发放方式
export function listIssue4Relation(query) {
  return request({
    url: "/coupon/issue/list4Relation",
    method: "get",
    params: query,
  });
}

// 用户优惠券导出
export function expexportCouponUser(query) {
  return request({
    url: "/coupon/user/export",
    method: "get",
    params: query,
  });
}

// 新增优惠券活动
export function addCouponActivity(data) {
  return request({
    url: "/coupon/activity/add",
    method: "post",
    data,
  });
}

// 删除优惠券活动
export function deleteCouponActivity(id) {
  return request({
    url: `/coupon/activity/delete/${id}`,
    method: "delete",
  });
}

// 删除优惠券活动
export function deleteCouponActivityByIds(ids) {
  return request({
    url: `/coupon/activity/batch/delete`,
    method: "post",
    data: ids, // 发送 ID 数组作为请求体
  });
}

// 修改优惠券活动
export function updateCouponActivity(data) {
  return request({
    url: "/coupon/activity/update",
    method: "put",
    data,
  });
}

// 根据ID查询优惠券活动
export function getCouponActivity(id) {
  return request({
    url: `/coupon/activity/get/${id}`,
    method: "get",
  });
}

// 查询所有优惠券活动
export function getAllCouponActivities(params) {
  return request({
    url: "/coupon/activity/getAll",
    method: "get",
    params: params, // 将传递的参数添加到 params 字段中
  });
}

// 查询包含标签的优惠券活动
export function getLabelCouponActivity(query) {
  return request({
    url: '/coupon/activity/getAllLabel',
    method: 'get',
    params: query
  })
}

// 更新优惠券活动状态
export function updateActivityStatus(activityId, activityStatus) {
  return request({
    url: `/coupon/activity/updateStatus/${activityId}/${activityStatus}`,
    method: "put",
  });
}

// 手动发券查询会员信息列表
export function listForCoupon(params) {
  return request({
    url: "/appUserInfo/info/listForCoupon",
    method: "get",
    params: params,
  });
}

// 查询优惠劵列表
export function creationList(params) {
  return request({
    url: "/coupon/creation/list",
    method: "get",
    params: params,
  });
}

// 手动发券
export function drawCoupons(data) {
  return request({
    url: "/coupon/activity/drawCoupons",
    method: "post",
    data: data,
  });
}



// 近日充值列表
export function getRecentChargeListApi(query){
  return request({
    url:'/customer/record/list',
    params:query
  })
 }

//  查询优惠券限制
export function getCouponLimit(data) {
  return request({
    url: '/coupon/activity/amtForList',
    method: 'post',
    data
  })
}
